package org.mm.proxycache.http;

import org.apache.mina.common.IoBuffer;
import org.mm.proxycache.http.codec.HttpParser;

public class HttpDecoderException extends Exception
{

    private static final long serialVersionUID = -6313748127319084335L;

    final private HttpParser parser;
    final private IoBuffer buffer;

    public HttpDecoderException( HttpParser parser, IoBuffer buffer )
    {
        super();
        this.parser = parser;
        this.buffer = buffer;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Throwable#toString()
     */
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder( 400 );
        sb.append( parser.state() ).append( " - " );
        sb.append( buffer.asCharBuffer() );

        return sb.toString();
    }
}
